package util

import (
	"fmt"
	"strconv"
	"strings"
)

func SplitIPAndPort(addr string) (ip string, port string, err error) {
	parts := strings.Split(addr, ":")
	if len(parts) != 2 {
		err = fmt.Errorf("无效的地址格式: %s", addr)
		return
	}

	ip = parts[0]
	port = parts[1]
	return
}

func ToServerPort(port string) string {
	atoi, _ := strconv.Atoi(port)
	return strconv.Itoa(atoi + 1000)
}
